<div class="container"> 
<!-- middle -->
<div id="middle" class="cols2">
	 
    <div class="content" role="main">
       
    	<article class="post-detail post-page">            
			<div class="entry">
				<label class="label_title"><strong>Last Status</strong></label>
				<div class="author-box">
						<div class="author-description">
							<div class="author-image"><img src="<?=profileThumb($profile['employeeAvatar'],$profile['EmployeeID'],200,100)?>" style="height:100%" alt=""><span class="author"><?=$profile['EmployeeFirstName']?></span></div>
							<div class="author-text">
								<p><span style="font-size:14px;font-weight:bold"><a href="#"><?=$profile['EmployeeFirstName']?></a></span> <br/><?=word_limiter($profile['EmployeeLastStatus'],40)?></p>
							</div>
							<div class="clear"></div>
						</div>        
				</div>
					
                <!-- contact form -->
				<?php if($my==$this->session->userdata('user_login')):?>
                        <div class="add-comment contact-form">
                            
                            <div class="comment-form" id="insertbeforMe">
                            <form action="" method="post" id="addCommentForm" class="ajax_form">
                                  
                                <div class="row">
                                    <label class="label_title"><strong>Message</strong></label>
                                    <textarea cols="30" rows="5" style="height:50px" name="message" id="body" class="textarea textarea_middle required"></textarea>
                                </div>
                                
                                <div class="row rowSubmit">
	                                <input type="submit" name="btnsubmit" id="submit" value="Say IT" class="btn-submit">
									<input type="hidden" value="<?=site_url()?>" id="baseurl"/>
                             	</div>
                            </form>
                            </div>
                        </div>
				<?php endif;?>		
                <!--/ contact form -->

				<!-- author description -->
				<label class="label_title"><strong><?=$profile['EmployeeFirstName']?> Wall</strong></label>
				<?php foreach($news as $news):?>
				<div class="news">
					<div class="author-box">
						<div class="author-description">
							<div class="author-image"><img src="<?=profileThumb($news['employeeAvatar'],$news['EmployeeID'],200,100)?>" style="height:100%" alt=""><span class="author"><?=$news['user_name']?></span></div>
							<div class="author-text">
								<p><span style="font-size:14px;font-weight:bold"><a href="<?=postUrl($news['post_date'],$news['post_id'],$news['post_title'])?>"><?=$news['post_title']?></a></span> <br/><?=word_limiter($news['post_content'],20)?></p>
								<?php if($news['EmployeeID']==$this->session->userdata('user_login')):?>
									<p><a class="delbutton" id="<?=$news['post_id']?>"  href="" >Remove</a></p>
								<?php endif;?>
							</div>
							<div class="clear"></div>
						</div>        
					</div>
				
							<!--Children-->
							<?php $comments = $this->posts->getCommentByPost($news['post_id']);
								  foreach($comments as $post):
							?>
							<div class="author-box" style="width:600px;margin-left:20px">
								<div class="author-description">
									<div class="author-image"><img src="<?=profileThumb($post['employeeAvatar'],$post['EmployeeID'],200,100)?>" alt=""><span class="author"><a href="<?=site_url('profile/index/'.$post['EmployeeID'])?>"><?=$post['user_name']?></a></span></div>
									<div class="author-text">
										<p><span style="font-size:14px;font-weight:bold"></span> <br/><?=$post['comment_content']?></p>
										<?php if($post['EmployeeID']==$this->session->userdata('user_login')):?>
											<p><a class="delcomment" id="<?=$post['comment_id']?>"  href="" >Remove</a></p>
										<?php endif;?>
									</div>
									<div class="clear"></div>
								</div>        
							</div>
						<!--Children-->
						<?php endforeach;?>
				
							<!-- contact form -->
							<script>
								$(document).ready(function(){		
									var baseurl = $('#baseurl<?=$news['post_id']?>').val();
									$('.comment-form<?=$news['post_id']?>').submit(function(){
									$.ajax({
										url  : '<?=site_url()?>/profile/addComment',
										data : $('#addCommentForm<?=$news['post_id']?>').serialize(),
										type : "POST",
										success : function(comment<?=$news['post_id']?>){
													$(comment<?=$news['post_id']?>).hide().insertBefore('#insertbeforeMe<?=$news['post_id']?>').slideDown('slow');
													}
										})
												return false;
									})
								})
								</script>

								<div class="add-comment contact-form">
										
								   <div class="comment-form<?=$news['post_id']?>" id="insertbeforeMe<?=$news['post_id']?>">
									<form action="<?=site_url('profile/addComment')?>" method="post" class="ajax_form" id="addCommentForm<?=$news['post_id']?>">
											<div class="row">
												<input type="hidden" name="post" value="<?=$news['post_id']?>"/>
												<label class="label_title"><strong>Your Comment</strong></label>
												<textarea cols="40" rows="5" style="height:50px" name="comment" class="textarea textarea_middle required"></textarea>
											</div>
											
											<div class="row rowSubmit" style="text-align:right;width:580px">
												<input type="hidden" value="<?=site_url()?>" id="baseurl<?=$news['post_id']?>"/>
												<input type="submit" name="btnsubmit" id="submit" value="Your Comment" class="btn-submit">
											</div>
										</form>
									  </div>
								</div>
							<!--/ contact form -->
					</div>
					<?php endforeach;?>
					<!--/ author description -->	
		
        	
            
            <div class="clear"></div>            
            </div>
            
            	
        </article>
        
        
	</div>
    <!--/ content -->
    
    <!-- sidebar -->
    <div class="sidebar">

		<!-- widget_contact -->
	        <div class="widget-container widget_contact">   
	            <div class="inner">   
	            	
	                <div class="contact-address">
	                	<div class="name"><strong><?=$myprofile['EmployeeFirstName']?></strong></div>
						<div class="address"><?=$myprofile['EmployeeTitle']?></div>
						<div class="phone"><em>Mobile:</em> <span><?=$myprofile['EmployeeHandPhone']?></span></div>
	                    <div class="fax"><em>Ext:</em> <span><?=$myprofile['EmployeeExtention']?></span></div>
		                <div class="mail"><em>Email:</em> <a href="#"><?=$myprofile['EmployeeEmail']?></a></div>
					</div>
		                  
					<!--<div class="contact-social">
		            	<div><a href="#" class="btn btn_skype">Skype</a></div>
		                <div><a href="#" class="btn btn_twitter">Twitter</a></div>
		                <div><a href="#" class="btn btn_fb">Facebook</a></div>
		           	<div class="clear"></div>
		            </div>
					-->
                    
                    <div class="contact-map">
						<img src="<?=profileThumb($myprofile['employeeAvatar'],$myprofile['EmployeeID'],300,150)?>" style="height:100%" alt="">
						<p><?=anchor('profile/My/'.$this->session->userdata('user_login'),'Update Profile')?></p>
		            </div>
                    
				</div>     
			</div>
	        <!--/ widget_contact -->
			
			<div class="widget-container widget_nav_menu">
			<img src="<?=base_url()?>/assets/images/icons/icons_16_menu.png" alt="" class="widget_icon">
           		<h3 class="widget-title">MY Program</h3>
                    <ul>
						<li><a href="http://bdotanubrata/timesheet/"><span>Timesheet</span></a></li>  
                        <li><a href="http://192.168.169.10/lbo/"><span>Letter System</span></a>
					</ul>
			</div> 	
            
			<br>            
        
    </div>
    <!--/ sidebar -->   
    
        	
</div>
<!--/ middle --> 
</div>
<!--/ container -->

<script>
	$(document).ready(function(){
    
    var baseurl = $('#baseurl').val();
    $('.comment-form').submit(function(){
        $.ajax({
            url : '<?=site_url()?>/profile/addPost',
            data : $('#addCommentForm').serialize(),
            type: "POST",
            success : function(comment){
                $(comment).hide().insertAfter('#insertbeforMe').slideDown('slow');
            }
        })
        return false;
    })
})
</script>

<script type="text/javascript">
$(document).ready(function() {
	$(".delbutton").click(function(){
		//Save the link in a variable called element
		var element = $(this);
		//Find the id of the link that was clicked
		var del_id = element.attr("id");
	 
 //Built a url to send
	var info = 'id=' + del_id;
	 if(confirm("Are You Sure Want to Delete Post ?"))
	 {
		$.ajax({
		type: "POST",
		url : "<?php echo site_url()?>/post/remove/",
		data: info,
		success: function(){
		}
	 });
	 $(this).parents(".news").animate({ opacity: "hide" }, "slow");
	 }
	 return false;
 
   });
   
   $(".delcomment").click(function(){
		//Save the link in a variable called element
		var element = $(this);
		//Find the id of the link that was clicked
		var del_id = element.attr("id");
	 
 //Built a url to send
	var info = 'id=' + del_id;
	 if(confirm("Are You Sure Want to Delete Your Comment ?"))
	 {
		$.ajax({
		type: "POST",
		url : "<?php echo site_url()?>/post/removeComment/",
		data: info,
		success: function(){
		}
	 });
	 $(this).parents(".author-box").animate({ opacity: "hide" }, "slow");
	 }
	 return false;
 
   });
 
})
</script>